package com.atguigu01._this.ex2;

public class Acount {
    private double balance;//余额

    public Acount(double balance) {
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }

    public void deposit(double amt){
        balance+=amt;
        System.out.println("成功存入"+amt+"元");
    }

    public void withdraw(double amt){
        if(balance>=amt){
            balance-=amt;
            System.out.println("成功取出"+amt+"元");
        }else{
            System.out.println("钱不够");
        }
    }
}
